home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / HackintoshBiblev1.3.sit / Hackintosh Bible v1.3.rsrc / TEXT_150.txt < prev    next >
Text File  |  1996-11-10  |  21KB  |  189 lines

  1. he parameter you use,  the safer your shutdown will be.  If you have to resort to 0 (re-boot), you will have the long wait for boot up associated with turning the computer off then on.
  2.     Memory Functions:
  3. Block Move    Moves blocks of memory.  Requires three parameters: source address, destination address, and length.  Enter these three address after one another on the line and hit return.
  4. Block Compare    Compares blocks of memory using the same three parameters as the Block Move command.  Any differences will be displayed as "Mismatch at xxxx/yyyy" where xxxx is the address of the source and yyyy is the address of the destination where the blocks do not match.
  5. Fill    Fills a block of memory with a specified value.  Takes four parametes with the fourth being optional: beginning address, ending address, fill value, and optionally, the size of the fill value - 1 for byte fill, 2 for word fill, and 4 for long word fill.
  6. Find    Finds a specified value in a specified range of memory.  Takes four parameters: search value, search value size (same as size from Fill command above), start address and end address.  If any matches are found, they will be displayed between the curly braces.
  7. Template    Displays a memory location as if it were a Mac data structure, showing you all the current values.  TMON currently knows only four data structures: WindowRecord, ControlRecord, TERecord, and ParamBlock (see IM for descriptions of these).  Clicking on the Template line hitting Return will cycle through these four templates.  Template takes one parameter, an address.  So, after finding the structure you wish to display, enter an address that contains a structure of that type and hit return.  TMON will list all current values for the fields of that structure.  Note that information will be meaningless unless there is actually a structure of the desired type at the address you specify.  This command could be helpful in looking at key disk checkers by allowing you to look at the ParamBlock the program is currently using to read the disk - although I have never used this.
  8. Stack addresses    Attempts to recognize as labels the supplied address.  This function defaults to an address of SP - stack pointer.  To use this, just click to left of SP and hit return.  The function will then look at the first address on the stack and see if it matches any labels that it currently knows.  For example, right after a JSR, the stack contains the return address.  If TMON k knows a label for the return address (and it will if there was a label to the left of the JSR in the assembly window) then using the Stack Addresses command will display the label in curly braces.  Hitting return repeatedly will then move up the stack, analysing each successive stack address.  Click in front of the SP and hit return to reset the command to the original stack pointer.
  9. Stack crawl    Attempts to find the return address of a procedure that has a currently active stack frame.  Remember that most compiled programs use the LINK and UNLK instructions to set up stack frames to temprarily store local variables.  If you know what register is being used as the stack frame pointer (A6 is the only one I have ever seen and this is the default value TMON uses), then the Stack Crawl can use that register to analyse the stack and try to determine the return address and display it in the curly braces.
  10. Load resource    Loades the resource specified by the two parameters (type and id #) into memory and displays the address of the resource in the curly braces.
  11. Print    Allows you to print listings longer that contained in the active window.  Clicking on the Print line and hitting return toggles the print mode between Dump, Assembly, File, and Heap.  Once the mode has been selected, the print command needs a start and end address.  Type these in, hit return, and TMON will print the desired output to the serial port (meaning that you cannot use a laserwriter, but you can use an imagewriter.)
  12.     A000 Trap Functions:
  13. Trap record    Unknown.  Allows you to record any traps called by the program, but requires a lot of complicated set up.
  14. Record    Unknown.  Used to allocate a table for trap record (above).
  15. Trap    Unknown.  Used by programmers to test the heap anytime a trap that affects the heap zone is called.  We don't need this to crack.
  16. Heap    Unknown.  Similar to Trap but doesn't wait for a trap to execute.  We don't need this one either.
  17. Trap discipline    A programmer's feature.  Trap discipline is a means of checking traps for faulty parameters.  Select a range of traps and a PC range (see Trap Intercept below) and TMON will check all traps within that range.  If it finds a trap with questionable parameters, the monitor will be entered.  There are two strengths of discipline: lenient and strict.  To toggle these, click on the trap discipline line and hit return.
  18. Trap checksum    Unknown.  Another function that programmers would use to check application problems.  Since we are cracking an application that already works, we don't need this one.
  19. Checksum    Unknown.  Used to specify the checksum for Trap Checksum.
  20. Trap intercept    Allows you to specify a trap or range of traps that, when encountered, will cause the monitor to be entered.  Simply click on the line and enter the trap name WITH a leading underscore, a space, and then the second trap.  This specifies a range of traps to look for, the range being in numerical order of trap numbers.  If only one trap is specified, only that trap will be checked.  Use this to catch a program that uses a dialog to prompt for a serial number.  If the trap entered is _ModalDialog, the monitor will be entered just before the dialog is drawn.  Optionally, a PC range may be entered after the trap range.  This would specify that TMON regain control only if the specified trap is encountered within the specified PC range.  I have never used a PC range.
  21. Trap signal    Similar to Trap Interrupt, except that once the trap range and optional PC range have been entered, the user must hit the interrupt switch to enter the monitor.  Once the interrupt switch (or Programmer's Key) has been pressed, TMON will continue execution until a trap within the specified range has been encountered.
  22. Options / Cmd-o
  23. Allows setting of seven monitor global functions.  I am not exactly clear what the various settings mean, so I jus leave them all on.
  24. Print / Cmd-p
  25. Causes the active window to be dumped to whatever port has been set during setup (achieved by launching the TMON application).  This prints a window's contents only!  To get long printouts, use the print command in the User Window.
  26.  
  27.  
  28. How to crack Sorcerer
  29. We are now going to look at a typical key-disk protection scheme.  The important concepts to grasp here are how to quickly isolate the protection, and then how to remove it.  Don't worry too much about the particulars, unless you happen to have a copy of Sorcerer you want to crack.
  30. First off, how do we know that it is protected?  Dumb question, but this is really important to beginning the crack.  With Sorcerer, we note that when launched from the hard drive, it brings up a dialog box (or alert) requesting the key disk.  So the logical place to start is with Resedit to try and figure out what resource the program is using to display the alert.
  31. After you open the application in Resedit, we see the following:
  32. 
  33. Well, there are no ALRT or DLOG resources, so the program is generating its own dialog internally.  If there was a set of ALRT or DLOG resources, we would quickly scan them and try to determine which was the one that the program displays to request the key-disk.  If we could locate the ID # of the correct DLOG resource, we would go into Nosy and bring up the Traps ref map, see which procs called GetNewDialog, or Alert (if the resource in question was ALRT), and then check all the procs Nosy listed to see which one called GetNewDialog with the ID # we had found in Resedit.
  34. Often you will find that there are DLOGs or ALRTs, but none of them have the correct message.  If this is the case, then we would be in the same spot we are right now.  The next thing to consider is that the string "Please Insert the Original Disk" (or whatever the string is) has to come from somewhere.  You can try to locate it in Nosy, but often the string will be in a string resource.  Look at the Resedit window above, and note the STR resource.  Let's take a look:
  35. Perfect!  There is the culprit.  So, all we have to do is find the part of Sorcerer that uses STR resource # 256.  Since there are several ways to load a string, you might want to forget the Traps ref map and start tracing the program.  If the program is huge, this might not be the way to go.  If you look at the Traps ref map for Sorcerer, you would eventually find that proc108 calls the trap GetString.  This would be an excellent place to start.  Otherwise you might just find the proc called Sorcerer and start tracing there...An important note:  tracing programs from start to error sucks.  If you can figure out which trap is causing the problem, then by all means do so.  If you are not familiar enough with the various traps, then you might well have to trace.  Get a hold of IM and learn the Dialog Manager and the Resource Manager!
  36. OK, let's start with the procedure Sorcerer:
  37.  
  38.    D50:                                 QUAL    Sorcerer ; b# =59  s#1  =proc38
  39.  
  40.  
  41.    D50: 4EBA 004C      1000D9E Sorcerer JSR     proc39
  42.    D54: 4E56 0000      'NV..'           LINK    A6,#0
  43.    D58: 2C5F           ',_'             POP.L   A6
  44.    D5A: 4E55 FCB6      'NU..'           LINK    A5,#-$34A
  45.    D5E: 9FED 0010          $10          SUBA.L  glob27(A5),A7
  46.    D62: 4EBA 0042      1000DA6          JSR     proc41
  47.    D66: 41ED FCB2        -$34E          LEA     glob2(A5),A0
  48.    D6A: 2F08           '/.'             PUSH.L  A0
  49.    D6C: 4EBA F292      1000000          JSR     proc1
  50.    D70: A8FE           '..'             _InitFonts  
  51.    D72: 3F3C FFFF      '?<..'           PUSH    #$FFFF
  52.    D76: 4267           'Bg'             CLR     -(A7)
  53.    D78: 4EBA F49A      1000214          JSR     FlushEvents
  54.    D7C: A912           '..'             _InitWindows  
  55.    D7E: A9CC           '..'             _TeInit  
  56.    D80: 42A7           'B.'             CLR.L   -(A7)
  57.    D82: A97B           '.{'             _InitDialogs ; (resumeProc:ProcPtr) 
  58.    D84: A850           '.P'             _InitCursor  
  59.    D86: 4EAD 0092      20003F6          JSR     proc108(A5)
  60.    D8A: 4EBA 0390      100111C          JSR     proc54
  61.    D8E: 4EBA 0156      1000EE6          JSR     %_TERM
  62.    D92: 4E5D           'N]'             UNLK    A5
  63.    D94: 4EBA 000E      1000DA4          JSR     proc40
  64.    D98: 4E75           'Nu'             RTS     
  65.  
  66.  
  67.    D9A: 4E5E                   data20   DC.B    'N^Nu'
  68.  
  69. A quick scan should reveal that possible problem areas are proc39, proc41, proc1, proc108, and proc54 since these are procedures that we can't see from this listing which is normal enough by itself.  Luckily, if you were to look at the first three procs called, they are very short and very benign.  If these were long, complex procedures, I might seriously consider going into TMON and setting a Trap Intercept to pick up _InitFonts so that TMON would grab control of the program early.  Then when I launch Sorcerer, if TMON breaks in then the error is later in the program, but if Sorcerer bombs, then the error was before the InitFonts.  That is a quick way to locate the problem.
  70. So, let's take a look at the next procedure, proc108:
  71.  
  72.    3F6:                                 QUAL    proc108 ; b# =194  s#2  =proc108
  73.  
  74.                                vem_1     VEQU  -1040
  75.                                vem_2     VEQU  -1038
  76.                                vem_3     VEQU  -1036
  77.                                vem_4     VEQU  -1034
  78.                                vem_5     VEQU  -1030
  79.                                vem_6     VEQU  -774
  80.                                vem_7     VEQU  -512
  81.    3F6:                                 VEND    
  82.  
  83.                                ;-refs -  1/proc37     1/Sorcerer  
  84.  
  85.    3F6: 4A6F EBE6      'Jo..'  proc108  TST     -$141A(A7)
  86.    3FA: 4E56 FBE6      'NV..'           LINK    A6,#-$41A
  87.    3FE: 48E7 0F18      'H...'           MOVEM.L D4-D7/A3-A4,-(A7)
  88.    402: 41EE FE00      200FE00          LEA     vem_7(A6),A0
  89.    406: 2848           '(H'             MOVEA.L A0,A4
  90.    408: 486E FBFA      200FBFA          PEA     vem_5(A6)
  91.    40C: 486E FBF0      200FBF0          PEA     vem_1(A6)
  92.    410: 486E FBF6      200FBF6          PEA     vem_4(A6)
  93.    414: A9F5           '..'             _GetAppParms ; (VAR apName:Str255; VAR apRefNum:INTEGER; VAR apParam:Handle) 
  94.    416: 4267           'Bg'             CLR     -(A7)
  95.    418: 41EE FCFA      200FCFA          LEA     vem_6(A6),A0
  96.    41C: 2F08           '/.'             PUSH.L  A0
  97.    41E: 486E FBF2      200FBF2          PEA     vem_2(A6)
  98.    422: 4EAD 0052      1000162          JSR     GetVol(A5)
  99.    426: 3E1F           '>.'             POP     D7
  100.    428: 4267           'Bg'             CLR     -(A7)
  101.    42A: 486E FBFA      200FBFA          PEA     vem_5(A6)
  102.    42E: 3F2E FBF2      200FBF2          PUSH    vem_2(A6)
  103.    432: 3F3C 0010      '?<..'           PUSH    #16
  104.    436: 2F0C           '/.'             PUSH.L  A4
  105.    438: 4267           'Bg'             CLR     -(A7)
  106.    43A: 4EBA FDBE      20001FA          JSR     proc103
  107.    43E: 181F           '..'             POP.B   D4
  108.    440: 4267           'Bg'             CLR     -(A7)
  109.    442: 3F2E FBF2      200FBF2          PUSH    vem_2(A6)
  110.    446: 2F0C           '/.'             PUSH.L  A4
  111.    448: 4EBA FED8      2000322          JSR     proc105
  112.    44C: 101F           '..'             POP.B   D0
  113.    44E: 0A00 0001      '....'           EORI.B  #1,D0
  114.    452: 6700 00A0      20004F4          BEQ     lem_2
  115.    456: 4267           'Bg'             CLR     -(A7)
  116.    458: 3F3C 0002      '?<..'           PUSH    #2
  117.    45C: 3F2E FBF2      200FBF2          PUSH    vem_2(A6)
  118.    460: 2F0C           '/.'             PUSH.L  A4
  119.    462: 4EBA FF0C      2000370          JSR     proc106
  120.    466: 101F           '..'             POP.B   D0
  121.    468: 0A00 0001      '....'           EORI.B  #1,D0
  122.    46C: 6700 0086      20004F4          BEQ     lem_2
  123.    470: 4267           'Bg'             CLR     -(A7)
  124.    472: 3F3C 0001      '?<..'           PUSH    #1
  125.    476: 3F2E FBF2      200FBF2          PUSH    vem_2(A6)
  126.    47A: 2F0C           '/.'             PUSH.L  A4
  127.    47C: 4EBA FEF2      2000370          JSR     proc106
  128.    480: 101F           '..'             POP.B   D0
  129.    482: 0A00 0001      '....'           EORI.B  #1,D0
  130.    486: 676C           20004F4          BEQ.S   lem_2
  131.    488: 42A7           'B.'             CLR.L   -(A7)
  132.    48A: 3F3C 0101      '?<..'           PUSH    #257
  133.    48E: 42A7           'B.'             CLR.L   -(A7)
  134.    490: 70FF           'p.'             MOVEQ   #-1,D0
  135.    492: 2F00           '/.'             PUSH.L  D0
  136.    494: A9BD           '..'             _GetNewWindow ; (windowID:INTEGER; wStorage:Ptr; behind:WindowPtr):WindowPtr 
  137.    496: 265F           '&_'             POP.L   A3
  138.    498: 2F0B           '/.'             PUSH.L  A3
  139.    49A: A873           '.s'             _SetPort ; (port:GrafPtr) 
  140.    49C: 3F3C 0010      '?<..'           PUSH    #16
  141.    4A0: 3F3C 001C      '?<..'           PUSH    #28
  142.    4A4: A893           '..'             _MoveTo ; (h,v:INTEGER) 
  143.    4A6: 4267           'Bg'             CLR     -(A7)
  144.    4A8: A887           '..'             _TextFont ; (font:FontCode) 
  145.    4AA: 42A7           'B.'             CLR.L   -(A7)
  146.    4AC: 3F3C 0100      '?<..'           PUSH    #256
  147.    4B0: A9BA           '..'             _GetString ; (stringID:INTEGER):StringHandle 
  148.    4B2: 2C1F           ',.'             POP.L   D6
  149.    4B4: 2046           ' F'             MOVEA.L D6,A0
  150.    4B6: 2F10           '/.'             PUSH.L  (A0)
  151.    4B8: A884           '..'             _DrawString ; (s:Str255) 
  152.    4BA: 4267           'Bg'             CLR     -(A7)
  153.    4BC: 42A7           'B.'             CLR.L   -(A7)
  154.    4BE: 3F3C 0001      '?<..'           PUSH    #1
  155.    4C2: 4EAD 002A      1000186          JSR     Eject(A5)
  156.    4C6: 3E1F           '>.'             POP     D7
  157.    4C8: 486E FBF4      200FBF4 lem_1    PEA     vem_3(A6)
  158.    4CC: 4EBA FEEE      20003BC          JSR     proc107
  159.    4D0: 4267           'Bg'             CLR     -(A7)
  160.    4D2: 3F2E FBF4      200FBF4          PUSH    vem_3(A6)
  161.    4D6: 2F0C           '/.'             PUSH.L  A4
  162.    4D8: 4EBA FE48      2000322          JSR     proc105
  163.    4DC: 1A1F           '..'             POP.B   D5
  164.    4DE: 4267           'Bg'             CLR     -(A7)
  165.    4E0: 42A7           'B.'             CLR.L   -(A7)
  166.    4E2: 3F2E FBF4      200FBF4          PUSH    vem_3(A6)
  167.    4E6: 4EAD 002A      1000186          JSR     Eject(A5)
  168.    4EA: 3E1F           '>.'             POP     D7
  169.    4EC: 1005           '..'             MOVE.B  D5,D0
  170.    4EE: 67D8           20004C8          BEQ     lem_1
  171.    4F0: 2F0B           '/.'             PUSH.L  A3
  172.    4F2: A914           '..'             _DisposWindow ; (theWindow:WindowPtr) 
  173.    4F4: 4CDF 18F0      'L...'  lem_2    MOVEM.L (A7)+,D4-D7/A3-A4
  174.    4F8: 4E5E           'N^'             UNLK    A6
  175.    4FA: 4E75           'Nu'             RTS     
  176.  
  177.  
  178.    4FC: '............'         data76   DC.W    $8100,8,0,$4FC,$FC00,0
  179. The first thing to do here is to quickly scan for trap names.  There are quite a few, but one should stick out.  Remember that we are looking for some reference to STR #256.  Note the GetString trap.  Immediately before the trap is a PUSH #256...that's our guy!  So, at this point, we know where the string is being loaded and drawn.  Since this procedure is called from the Main procedure, we can bet that the key-disk check is also in this proc.  Note that this is not always the case - often when you find the procedure that loads the dialog or string, you need to back trace to find out where the actual error generator is located.  That is where the Refs line (right below the VEND) in the listing comes in handy.  Note that this proc is called by not only Sorcerer, but also by proc37.  This might mean that the program checks the key-disk later in its execution.  But if you load up proc37, you would find that it simply Unloads the segment so it is harmless.
  180. At this point, all we need to do is disable the disk-check.  So, start scanning down the listing and ask yourself "Where is a branch that will skip over the GetString trap?".  If you find that branch and make it always branch then odds are the program is cracked.  Nosy will help out here.  We are looking for a spot in the listing that a branch can jump to that will skip over the error.  We have two choices in this listing: lem_1 and lem_2.  Check out lem_1, and you will see a couple of problems with it.  First of all, see what piece of code branches to it.  There is a JSR  Eject, then a test, and a BEQ lem_1.  Also note that there is a DisposeWindow after it.  We might guess that DisposeWindow is disposing the error dialog.  We might also guess that lem_1 is being used as a loop to eject bad disks and request key-disks.  Well, let's give lem_2 a shot.  Now this one looks good - it is located right down at the procedures exit, so, if something is branching here, all the above stuff gets skipped.
  181. So, just select lem_2 and hit cmd-f to let Nosy find all the references to lem_2 in the listing.  Line 452 is the key.  Note, D0 gets a result from an unknow procedure, then is EORd with 1, and then the branch occurs.  It sure looks like changing that branch from BEQ to BRA would gurrantee that the error never occured.  Let's try it.  From the assembly instruction listing, we see that BEQ is 67, and BRA is 60.  So, look at the first line in the above listing and we see that it is segment 2.  So, open CODE resource 2 in Resedit, and skip down to address 456 (remember, take the Nosy address and add 4 to find the Resedit address).  
  182. 
  183. There it is, on line 450.  See the 6700?  That sure matches what we find in Nosy, so that is our guy.  Change the 67 to 60 by clicking to the right of the 67, hitting backspace or delete, and typing 60.  That's it!  Now quit Resedit and save changes.  Launch the program and the protection is gone!
  184. Let me quickly mention one last thing.  The above crack involved looking for a branch that would skip over the problem area, and making damn sure that that branch always executed.  But suppose that the program was setup so that after the disk check, the program branched to the error section.  In this case, we would want to make sure the branch never executed.  There are two ways to do this.  First off, you can change the branch to its logical opposite - BCC to BCS, BNE to BEQ, etc.  That way, the condition that triggers the error will now trigger the opposite, and run properly.  The second method is to simply replace the trap with a NOP.  That way, the branch never executes no matter what happens.
  185. Look for upcoming material on more specific cracking methods and more actual cracks.
  186. later
  187.  
  188. - The Shepherd